#pragma once

namespace gtl
{

template<class Lock>
class locker
{
	locker(const locker&);
	locker& operator=(const locker&);

public:
	locker(Lock* lock) : m_lock(lock)
	{
		m_lock->lock();
	}

	locker(Lock& lock) : m_lock(&lock)
	{
		m_lock->lock();
	}

	~locker() throw()
	{
		m_lock->unlock();
	}

private:
	Lock* m_lock;
};


} // end of namespace gtl